<?php $nav_users = 'active'; ?>
@extends('layouts.app')

@section('css')
    <!-- Select2 -->
    <link rel="stylesheet" href="{{ asset("/bower_components/AdminLTE/plugins/select2/select2.min.css") }}">
@endsection

@section('js')
    <!-- Select2 -->
    <script src="{{ asset("/bower_components/AdminLTE/plugins/select2/select2.full.min.js") }}"></script>
    <!-- Page script -->
    <script>
        $(function () {
            //Initialize Select2 Elements
            $(".select2").select2();
        });
    </script>
@endsection

@section('content')
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="box box-success">
                {!! Form::model($user, ['method'=>'PATCH', 'url'=>'/console/users/'.$user->id]) !!}

                <div class="box-header">
                    <h3 class="box-title">修改用户</h3>
                </div>
                <div class="box-body">
                    @include('errors.list')

                    <div class="form-group">
                        {!! Form::label('name', '用户名:') !!}
                        {!! Form::text('name', null, ['class'=>'form-control']) !!}
                    </div>
                    <div class="form-group">
                        {!! Form::label('email', '邮箱:') !!}
                        {!! Form::email('email', null, ['class'=>'form-control']) !!}
                    </div>
                    <div class="form-group">
                        {!! Form::label('new_password', '密码:') !!}
                        {!! Form::text('new_password', null, ['class'=>'form-control']) !!}
                    </div>
                    <div class="form-group">
                        {!! Form::label('role_list', '角色:') !!}
                        {!! Form::select('role_list[]', $roles, null, ['class'=>'form-control select2', 'multiple'=>'multiple']) !!}
                    </div>
                </div>

                <div class="box-footer">
                    {!! Form::submit('保存', ['class'=>'btn btn-primary form-control']) !!}
                </div>

                {!! Form::close() !!}
            </div>
        </div>
    </div>
@endsection